<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>swiper</title>
    <style>
        .swiper {
            width: 900px;
            height: 300px;
            overflow: hidden;
            position: relative;
        }
        .father {
            height: inherit;
            width: 500%; /* 子元素 float 无法撑开 */
            transform: translate3d(0, 0, 0);
            transition: all 0.3s ease-in-out;
            position: absolute;
            left: 0;
            top: 0;
        }
        .father > div {
            width: 900px;
            height: inherit;
            float: left;
        }

        img{
            width: 100%;
        }
        .mother {
            width: 30px;
            height: inherit;
            line-height: 300px;
            text-align: center;
            cursor: pointer;
            user-select:none;
            background: rgba(0,0,0,0.15);
            position: absolute;top: 0;
        }
        .mother.left { left: 0 } .mother.right { right: 0 }
    </style>
</head>
<body>
<div class="swiper" id="example">
    <div class="father swiper-wrapper">
        <div class="swiper-item"><img src="https://cn.bing.com/az/hprichbg/rb/ManateeMom_EN-CN9983570199_1920x1080.jpg" alt=""></div><!-- 1 -->
        <div class="swiper-item"><img src="https://cn.bing.com/az/hprichbg/rb/MontezumaSnowGeese_EN-CN9497504365_800x480.jpg" alt=""></div>
        <div class="swiper-item"><img src="https://cn.bing.com/az/hprichbg/rb/Kolonihavehus_EN-CN6388656996_800x480.jpg" alt=""></div><!-- 3 -->
    </div>
    <div class="mother left">左</div>
    <div class="mother right">右</div>
</div>
</body>
</html>
<script src="./swiper.js"></script>
<script>
    new Swiper({
        container: document.querySelector('.swiper'),
        speed: 3000,
    })
</script>